<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/skin_/main.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.dialog.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/global.js"></script>
    <script type="text/javascript" src="../js/jquery.cookie.js"></script>
    <script type="text/javascript" src="../js/application.js"></script>

<title>（学生端）毕业设计（论文）管理系统</title>
</head>

<body>
<div id="container">
	<div id="hd">
    	<div class="hd-top">
            <h1 class="logo"><a href="javascript:;" class="logo-icon"></a></h1>


            <div class="setting ue-clear">
            	<div class="setting-skin">
                	<!--<div class="switch-bar">
                    	<i class="skin-icon"></i>
                        <span class="text">皮肤</span>
                        <i class="arrow-icon"></i>
                    </div>-->
                </div>
                <ul class="setting-main ue-clear">
                	<li><a href="main.html">桌面</a></li>
                    <li><a href="javascript:;">设置</a></li>
                    <li><a onclick="help()" ;">帮助</a></li>
                    <li><a href="javascript:;" class="close-btn exit"></a></li>
                </ul>
            </div>
            <div class="user-info">
                <a href="javascript:;" class="user-avatar"><span><i class="info-num">!</i></span></a>
                <span class="user-name" name="user-name"></span>
                <a href="javascript:;" class="more-info"></a>
            </div>
        </div>


    <div id="bd">
        <iframe width="100%" height="100%" id="mainIframe" src="nav.html" frameborder="0"></iframe>
    </div>
    
    <div id="ft" class="ue-clear">
    	<div class="ft1 ue-clear">
        	<i class="ft-icon1"></i> <span><a href="#" target="_blank" title=""></a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank"></a></span>
            <em></em>
        </div>
        <div class="ft2 ue-clear">
        	<span></span>
            <em></em>
            <i class="ft-icon2"></i>
        </div>
    </div>
</div>

<div class="exitDialog">
	<div class="content">
    	<div class="ui-dialog-icon"></div>
        <div class="ui-dialog-text">
        	<p class="dialog-content">你确定要退出系统？</p>
            <p class="tips">如果是请点击“确定”，否则点“取消”</p>
            
            <div class="buttons">
                <input type="button" class="button long2 ok" onclick="logout()" value="确定" />
                <input type="button" class="button long2 normal" value="取消" />
            </div>
        </div>
        
    </div>
</div>

<div class="opt-panel user-opt" style="top:52px;right:95px ;">
	<ul>
    	<li><a class="text">用户资料</a></li>
        <li><a class="text">短消息<span class="num"></span></a></li>
        <li><a class="text">资料信息</a></li>
        <li><a class="text">注销</a></li>
        <li><a class="text">自定义</a></li>
    </ul>
    <div class="opt-panel-tl"></div>
    <div class="opt-panel-tc"></div>
    <div class="opt-panel-tr"></div>
    <div class="opt-panel-ml"></div>
    <div class="opt-panel-mr"></div>
    <div class="opt-panel-bl"></div>
    <div class="opt-panel-bc"></div>
    <div class="opt-panel-br"></div>
    <div class="opt-panel-arrow"></div>
</div>

<div class="opt-panel skin-opt" style="top:36px;right:157px;">
	<ul class="ue-clear">
    	<li attr-color="#0f8dc7"></li>
        <li attr-color="#1ea4a9"></li>
        <li attr-color="#eb7f00"></li>
        <li attr-color="#ed0f04"></li>
        <li attr-color="#f24b39"></li>
        <li attr-color="#ed0f04"></li>
        <li attr-color="#eb7f00"></li>
        <li attr-color="#ed0f04"></li>
        <li attr-color="#1ea4a9"></li>
    </ul>
    <div class="opt-panel-ml"></div>
    <div class="opt-panel-mr"></div>
    <div class="opt-panel-bl"></div>
    <div class="opt-panel-bc"></div>
    <div class="opt-panel-br"></div>
</div>



</body>
<script type="text/javascript" src="js/core.js"></script>
<script type="text/javascript" src="js/jquery.dialog.js"></script>
<script type="text/javascript">

$("#bd").height($(window).height()-$("#hd").outerHeight()-26);

$(window).resize(function(e) {
    $("#bd").height($(window).height()-$("#hd").outerHeight()-26);

});

$('.exitDialog').Dialog({
	title:'提示信息',
	autoOpen: false,
	width:400,
	height:200
});

$('.exit').click(function(){
	$('.exitDialog').Dialog('open');
});

$('.exitDialog input[type=button]').click(function(e) {
    $('.exitDialog').Dialog('close');
	

});

(function(){
	var totalWidth = 0, current = 1;
	
	$.each($('.nav').find('li'), function(){
		totalWidth += $(this).outerWidth();
	});
	
	$('.nav').width(totalWidth);
	
	function currentLeft(){
		return -(current - 1) * 93;	
	}
	
	$('.nav-btn a').click(function(e) {
		var tempWidth = totalWidth - ( Math.abs($('.nav').css('left').split('p')[0]) + $('.nav-wrap').width() );
        if($(this).hasClass('nav-prev-btn')){
			if( parseInt($('.nav').css('left').split('p')[0])  < 0){
				current--;
				Math.abs($('.nav').css('left').split('p')[0]) > 93 ? $('.nav').animate({'left': currentLeft()}, 200) : $('.nav').animate({'left': 0}, 200);
			}
		}else{

			if(tempWidth  > 0)	{
				
			   	current++;
				tempWidth > 93 ? $('.nav').animate({'left': currentLeft()}, 200) : $('.nav').animate({'left': $('.nav').css('left').split('p')[0]-tempWidth}, 200);
			}
		}
    });
	
	
	
	$.each($('.skin-opt li'),function(index, element){
		if((index + 1) % 3 == 0){
			$(this).addClass('third');	
		}
		$(this).css('background',$(this).attr('attr-color'));
	});
	
	$('.setting-skin').click(function(e) {
        $('.skin-opt').show();
    });
	
	$('.skin-opt').click(function(e) {
        if($(e.target).is('li')){
			alert($(e.target).attr('attr-color'));	
		}
    });
	
	$('.hd-top .user-info .more-info').click(function(e) {
       $(this).toggleClass('active'); 
	   $('.user-opt').toggle();
    });
	
	$('.logo-icon').click(function(e) {
         $(this).toggleClass('active'); 
	     $('.system-switch').toggle();
    });
	
	hideElement($('.user-opt'), $('.more-info'), function(current, target){

		$('.more-info').removeClass('active'); 
	});
	
	hideElement($('.skin-opt'), $('.switch-bar'));
	
	hideElement($('.system-switch'), $('.logo-icon'), function(current, target){

		$('.logo-icon').removeClass('active'); 
	});
})();

//=======================================================
window.onload = function(){
    getLogo();
    getNotice();
};
function getLogo() {
    debugger;
    var jon = {};
    jon['token'] = getCookie("token");
    $.ajax({
        url: "/getLogo",
        type: "POST",
        data: {"jon":JSON.stringify(jon)},
        success: function (user) {
            debugger;
            console.log(user);
            var jsonUser = JSON.parse(user);
            var obj = eval("(" + jsonUser + ")");
            var currName =obj.name;
                $(document).ready(function() {
                $("span[name='user-name']").each(function() {
                    $(this).text(currName);
                });
            });

        },
    error: function () {
        window.location.href = "/login/login.html?error=token失效，重新登录";
    }
    })
}

function getNotice() {
    var jon = {};
    jon['token'] = getCookie("token");
    $.ajax({
        url: "/getMyNotice",
        type: "POST",
        data: {"jon":JSON.stringify(jon)},
        success: function (res) {
            var json = eval("("+res+")");
            if(json.length == 0){
                $('.info-num').html('');
            }else {
                $('.info-num').html(json.length);

            }
        }
    });
}

function logout() {
    deletedCookie();
    window.location.href="../login/login.html";
}

function help(){
    debugger;
    //===============================
    var form=$("<form>");
    form.attr("style","display:none");
    form.attr("class","downForm");
    form.attr("target","");
    form.attr("method","post");//提交方式为post
    form.attr("action","/downTxt");//定义action
    //=================================
    var input = $("<input>");
    input.attr("name","addr");
    input.attr("id","addrtext");
    input.attr("type","text");
    input.attr("value","D:\\idea workspace\\graduationManager-server-feign\\src\\main\\resources\\templates\\高阳的论文.doc");
    $("body").append(form);
    $(".downForm").append(input);
    debugger;
    form.submit();
}
</script>

</html>
